package com.ai.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ai.web.service.ProductInfoService;
import com.ai.web.vo.ProductInfoV;
import com.ai.web.vo.ResultModel;
import com.tiny.persistence.domain.ProductInfo;
import com.tiny.persistence.repository.ProductInfoRepo;

@Service
public class ProductInfoServiceImpl extends BaseServiceImpl<ProductInfo, Integer, ProductInfoV> implements ProductInfoService  {

    @Autowired
    private ProductInfoRepo productInfoRepo;
    
    @Autowired
    public ProductInfoServiceImpl(ProductInfoRepo productInfoRepo) {
        super(productInfoRepo);
    }

    public ProductInfoV getProductInfo(int userId) throws Exception {
        return getT(userId);
    }

    public ResultModel saveProductInfo(ProductInfoV productInfoV) throws Exception {
        
        ProductInfoV saveV = saveT(productInfoV);
        
        ResultModel rm = new ResultModel();
        rm.setData(saveV);
        rm.setSuccessCode();
        
        return rm;
    }

    public ResultModel deleteProductInfos(List<Integer> userIds) throws Exception {
        deleteTs(userIds);
        
        ResultModel rm = new ResultModel();
        rm.setSuccessCode();
        rm.setMsg("删除成功！");
        
        return rm;
    }

}
